﻿using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using KC.Framework.Tenant;
using KC.Model.Admin;

namespace KC.DataAccess.Admin.Repository
{
    public interface ITenantUserRepository : Domain.Core.IRepository.IDbRepository<TenantUser>
    {
        bool ExistTenantName(string tenantName);
        IList<TenantUser> FindAllDetailTenantUsers();
        Tuple<int, IList<TenantUser>> FindPagenatedTenantsByApplicationId(int pageIndex, int pageSize, Guid applicationId, string tenantDisplayName, List<string> exceptTenants = null, bool IsShowExceptTenants = false);
        List<string> FindTenantName(string tenantName);
        IList<TenantUser> GetAllOpenAppTenantsWithoutTestTenant(Guid appId, TenantType? tally = null);
        IList<TenantUser> GetAllOpenAppTenantsWithoutTestTenant(Guid appId, string currentTenantName, TenantType? tally = null);
        IList<TenantUser> GetAllTenants();
        IList<TenantUser> GetAllTenantsWithoutTests(Guid appId, string exceptTenantName);
        TenantUser GetDetailTenantById(int id);
        IList<TenantUser> GetFinanceLeaseandSupplyChainFinanceInstitutionTenantsWithoutTestTenant(Guid appId);
        IList<TenantUser> GetOpenAppsTenantUsersByIds(List<int> ids);
        IList<TenantUser> GetOpenAppTenantsByNames(Guid appId, List<string> tenantNames);
        TenantUser GetTenantByName(string tenantName);
        Task<TenantUser> GetTenantByNameAsync(string tenantName);
        Task<TenantUser> GetTenantByNameOrNickNameAsync(string tenantName);
        IList<TenantUser> GetTenantByTally(Guid appId, TenantType? tally);
        string GetTenantDisplayNameByName(string name);
        Task<TenantUser> GetTenantEndWithDomainName(string domainName);
        TenantUser GetTenantUserByOpenAppId(Guid applicationId, string tenantName);
        IList<TenantUser> GetTenantUsersDetailByNames(List<string> tenantNames);
        List<Tuple<string, string>> QueryTenantByKey(string key, int len = 10);
        bool SaveTenantApplications(int tenantId, List<Guid> applicationIds);
    }
}